package com.lx.nba.handle;

import java.sql.Date;
import java.util.List;
import java.util.Map;

import org.jsoup.nodes.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.support.DaoSupport;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lx.nba.dao.TeamDao;
import com.lx.nba.service.DownLoadDataService;
import com.lx.nba.service.InitNBAData;
import com.lx.nba.util.Context;
import com.lx.nba.util.Result;

@Controller
@RequestMapping("get/team")
public class GetTeamListHandle {

	@Autowired
	private InitNBAData initNBATeam ;
	
	@Autowired
	private TeamDao dao ;
	
	@RequestMapping(method= RequestMethod.GET)
	public @ResponseBody Map get(){
		
		Result result = new Result() ;
			
		result.addParam("list", dao.getAllTeams());
			
		return result.getParam() ;
		
	}
	
	@RequestMapping( method= RequestMethod.POST)
	public @ResponseBody Map get(@RequestBody String id ){
		
		Result result = new Result() ;
		
		result.addParam("man", dao.getTeamById(Integer.valueOf(id)));
		
		return result.getParam() ;
		
	}
	
	
}
